-- Localized Functions for the European Version; I am too lazy to exclude the localizations in a more separate way!
-- Outsorced functions:
-- _Yell, _Emote, _Enter_Combat

if ( GetLocale() == "deDE" or GetLocale() == "enGB" or GetLocale() == "enUS" or GetLocale() == "frFR" or GetLocale() == "esES") then

-- === defined by instance === --

	function NECB_PvE_CodeInit(noreg)

		if (not noreg and not NECB_no_PvE_code) then
			return;
		end
		NECB_no_PvE_code = false;

	 if (GetRealZoneText() == NECB_BlackwingLair and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)
			if (arg2 == "Nefarian") then
	
				if (string.find(arg1, NECB_PvE_Vars["NEFARIAN_SHAMAN_CALL"])) then 
					CEnemyCastBar_Control("Shamans", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_DRUID_CALL"])) then 
					CEnemyCastBar_Control("Druids", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_WARLOCK_CALL"])) then 
					CEnemyCastBar_Control("Warlocks", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_PRIEST_CALL"])) then 
					CEnemyCastBar_Control("Priests", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_HUNTER_CALL"])) then 
					CEnemyCastBar_Control("Hunters", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_WARRIOR_CALL"])) then 
					CEnemyCastBar_Control("Warriors", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_ROGUE_CALL"])) then 
					CEnemyCastBar_Control("Rogues", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_PALADIN_CALL"])) then 
					CEnemyCastBar_Control("Paladins", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_MAGE_CALL"])) then 
					CEnemyCastBar_Control("Mages", "Nefarian calls", "pve");
				elseif (string.find(arg1, NECB_PvE_Vars["NEFARIAN_LAND"])) then
					CEnemyCastBar_Control("Nefarian", "Landing", "pve");
				end
	
			elseif (arg2 == "Lord Victor Nefarius") then
		
				if (string.find(arg1, NECB_PvE_Vars["NEFARIAN_STARTING"])) then	
					CEnemyCastBar_Control("Nefarian", "Mob Spawn", "pve");
				end

			elseif (string.find(arg2, "Grethok ") ) then
	
				if (string.find(arg1, NECB_PvE_Vars["RAZORGORE_CALL"])) then
					CEnemyCastBar_Control("Razorgore", "Mob Spawn (45sec)", "pve");
				end
			end
		end
		function NECB_PvE_Emote(arg1, arg2)

			if (arg2 == NECB_PvE_Vars["FLAMEGOR_NAME"]) then
			
				if (string.find(arg1, NECB_PvE_Vars["FLAMEGOR_FRENZY"])) then
			
					CEnemyCastBar_Control("Flamegor", "Frenzy (CD)", "pve");
				end
			
			elseif (arg2 == "Chromaggus") then
			
				if (string.find(arg1, NECB_PvE_Vars["CHROMAGGUS_FRENZY"])) then
			
					CEnemyCastBar_Control("Chromaggus", "Killing Frenzy", "pve");
				end
			end
		end
		function NECB_PvE_EnterCombat(targetmob)
			if (targetmob == NECB_PvE_Vars["FIREMAW_NAME"] or targetmob == NECB_PvE_Vars["FLAMEGOR_NAME"] or targetmob == NECB_PvE_Vars["EBONROC_NAME"]) then
	
				CEnemyCastBar_Control(targetmob, "First Wingbuffet", "engage");
			end
		end

	 elseif (GetRealZoneText() == NECB_MoltenCore and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)
	
			if (arg2 == "Ragnaros") then
			
				if (string.find(arg1, NECB_PvE_Vars["RAGNAROS_STARTING"])) then
			
					CEnemyCastBar_Control("Ragnaros", "Submerge", "pve");
				
				elseif (string.find(arg1, NECB_PvE_Vars["RAGNAROS_KICKER"])) then
				
					CEnemyCastBar_Control("Ragnaros", "Knockback", "pve");
					
				elseif (string.find(arg1, NECB_PvE_Vars["RAGNAROS_SONS"])) then
				
					CEnemyCastBar_Control("Ragnaros", "Sons of Flame", "pve");
				
				end
			end
		end
		function NECB_PvE_Emote() end
		function NECB_PvE_EnterCombat() end


	 elseif (GetRealZoneText() == NECB_AhnQiraj and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)

			if (string.find(arg2, " Sartura") ) then
			
				if (string.find(arg1, NECB_PvE_Vars["SARTURA_CALL"])) then
	
					CEnemyCastBar_Control("Sartura", "Enraged mode", "pve");

				end
			end
		end
		function NECB_PvE_Emote(arg1, arg2)
	
			if (string.find(arg2, " Sartura") ) then
			
				if (string.find(arg1, NECB_PvE_Vars["SARTURA_CRAZY"])) then
	
					CEnemyCastBar_DelBar("Enraged mode");
					CEnemyCastBar_Control("Sartura", "Enters Enraged mode", "pve");
				end
	
			elseif (string.find(arg2, " Huhuran") ) then
			
				if (string.find(arg1, NECB_PvE_Vars["FLAMEGOR_FRENZY"])) then
			
					CEnemyCastBar_Control("Huhuran", "Frenzy (CD)", "pve");
	
				elseif (string.find(arg1, NECB_PvE_Vars["HUHURAN_CRAZY"])) then
	
					CEnemyCastBar_DelBar("Berserk mode");
					CEnemyCastBar_Control("Huhuran", "Enters Berserk mode", "pve");
				end
	
			elseif (string.find(NECB_PvE_Vars["CTHUN_NAME1"], arg2) ) then
			
				if (string.find(arg1, NECB_PvE_Vars["CTHUN_WEAKENED"])) then
	
					CEnemyCastBar_Control("C'Thun", "Weakened!", "pve", "true");
				end
			end
		end
		function NECB_PvE_EnterCombat(targetmob)

			if (string.find (targetmob, " Yauj") or string.find (targetmob, " Kri") or targetmob == "Vem" ) then

				CEnemyCastBar_Control("Detected", "Boss incoming", "engage"); -- to allow the (protected) fear, "Boss incoming".t = 0 ^^

			elseif (string.find (targetmob, "Huhuran") ) then
	
				CEnemyCastBar_Control("Huhuran", "Berserk mode", "engage");
	
			elseif (targetmob == "Ouro" ) then
			
				CEnemyCastBar_Control("Ouro", "Possible Ouro Submerge", "engage");

	
			elseif (string.find (targetmob, NECB_PvE_Vars["CTHUN_NAME1"]) ) then
	
				CEnemyCastBar_Control("C'Thun", "First Dark Glare", "engage");
				CEnemyCastBar_Control("C'Thun", "Small Eyes P1", "pve");


			elseif ( (string.find (targetmob, "Vek'lor") or string.find (targetmob, "Vek'nilash") ) ) then

				CEnemyCastBar_Control("Twins", "Enraged mode", "engage");
				CEnemyCastBar_Control("Twins", "Twin Teleport", "pve");
				CEnemyCastBar_Control("Twins", "Zwillingsteleport", "pve");
				CEnemyCastBar_Control("Twins", "T\195\169l\195\169portation des jumeaux", "pve");

			end
		end

	 elseif (GetRealZoneText() == NECB_ZulGurub and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)
	
			if (arg2 == "Hakkar") then
			
				if (string.find(arg1, NECB_PvE_Vars["HAKKAR_YELL"])) then
	
					CEnemyCastBar_Control("Hakkar", "Enraged mode", "pve");
	
					CEnemyCastBar_Control("Hakkar", "Blood Siphon", "pve", nil, "CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS");
					CEnemyCastBar_Control("Hakkar", "Bluttrinker", "pve", nil, "CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS");
					CEnemyCastBar_Control("Hakkar", "Siphon de sang", "pve", nil, "CHAT_MSG_SPELL_PERIODIC_CREATURE_BUFFS");

				end
			end
		end
		function NECB_PvE_Emote() end
		function NECB_PvE_EnterCombat() end

	 elseif (GetRealZoneText() == NECB_Naxxramas and not noreg) then

		function NECB_PvE_Yell(arg1, arg2)
	
			if (arg2 == NECB_PvE_Vars["PATCHWERK_NAME"]) then
			
				if (string.find(arg1, NECB_PvE_Vars["PATCHWERK_NAME"]) ) then
			
					CEnemyCastBar_Control("Patchwerk", "Enraged Mode", "pve");
					
				end
	
			elseif (string.find(arg2, " Razuvious") ) then
	
					CEnemyCastBar_Control("Razuvious", "Disrupting Shout", "engage");
					CEnemyCastBar_Control("Razuvious", "Unterbrechungsruf", "engage");
					CEnemyCastBar_Control("Razuvious", "Cri perturbant", "engage");
	
					NECBEvents1:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE");
					NECBEvents1:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE");
		 
			elseif (string.find(arg2, " Faerlina") ) then
	
				if (string.find(arg1, NECB_PvE_Vars["FAER_YELL1"]) or string.find(arg1, NECB_PvE_Vars["FAER_YELL2"]) or string.find(arg1, NECB_PvE_Vars["FAER_YELL3"]) or string.find(arg1, NECB_PvE_Vars["FAER_YELL4"]) ) then
			
					CEnemyCastBar_Control("Faerlina", "Enrage", "pve");
					CEnemyCastBar_Control("Faerlina", "Wutanfall", "pve");
					CEnemyCastBar_Control("Faerlina", "Enrager", "pve");
					
				end
			
			elseif (string.find(arg2, "Gothik ") ) then
			
				if (string.find(arg1, NECB_PvE_Vars["GOTHIK_YELL"]) ) then

					CEnemyCastBar_Control("Gothik", "Comes Down", "pve");
					CEnemyCastBar_Control("Gothik", "First Trainees", "pve");
					CEnemyCastBar_Control("Gothik", "First Deathknights", "pve");
					CEnemyCastBar_Control("Gothik", "First Rider", "pve");

				end
	
			elseif (arg2 == "Anub'Rekhan") then
	
				if (string.find(arg1, NECB_PvE_Vars["ANUB_YELL1"]) or string.find(arg1, NECB_PvE_Vars["ANUB_YELL2"]) or string.find(arg1, NECB_PvE_Vars["ANUB_YELL3"]) ) then
				
					CEnemyCastBar_Control("Anub'Rekhan", "First Locust Swarm", "pve");
	
				end
	
			elseif (string.find(arg2, "Noth ") ) then
			
					CEnemyCastBar_Control("Noth", "First Teleport", "engage");
	
			elseif (string.find(arg2, "Heigan ") ) then
			
				if (string.find(arg1, NECB_PvE_Vars["HEIGAN_YELL1"]) or string.find(arg1, NECB_PvE_Vars["HEIGAN_YELL2"]) or string.find(arg1, NECB_PvE_Vars["HEIGAN_YELL3"]) ) then
				
					CEnemyCastBar_Control("Heigan", "Teleport CD", "pve");
				
				elseif (string.find(arg1, NECB_PvE_Vars["HEIGAN_TELEPORT_YELL"]) ) then
				
					CEnemyCastBar_Control("Heigan", "On Platform", "pve");
				
				end
	
			end
		end
		function NECB_PvE_Emote() end
		function NECB_PvE_EnterCombat(targetmob)

			if (targetmob == "Gluth" ) then
	
				CEnemyCastBar_Control("Gluth", "Decimate", "engage");
				CEnemyCastBar_Control("Gluth", "Dezimieren", "engage");
				CEnemyCastBar_Control("Gluth", "D\195\169cimer", "engage");
				NECBEvents1:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_PARTY_DAMAGE");
				NECBEvents1:RegisterEvent("CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE");
	
			elseif (targetmob == "Maexxna" ) then
	
				CEnemyCastBar_Control("Maexxna", "Web Spray", "engage");
				CEnemyCastBar_Control("Maexxna", "Gespinstschauer", "engage");
				CEnemyCastBar_Control("Maexxna", "Jet de rets", "engage");
	
			elseif (targetmob == "Loatheb" ) then
	
				CEnemyCastBar_Control("Loatheb", "15 sec Doom CD!", "engage");
				CEnemyCastBar_Control("Loatheb", "First Inevitable Doom", "pve");

			elseif (targetmob == "Sapphiron" or targetmob == "Saphiron" ) then
	
				CEnemyCastBar_Control(targetmob, "Enraged mode", "engage");

			end

		end

	 elseif (GetRealZoneText() == NECB_OnyxiaLair and not noreg) then
		function NECB_PvE_Yell() end
		function NECB_PvE_Emote(arg1, arg2)
	
			if (arg2 == "Onyxia") then
			
				if (string.find(arg1, NECB_PvE_Vars["ONY_DB"])) then
				
					CEnemyCastBar_Control("Onyxia", "Deep Breath", "pve");
				end 
			end
		end
		function NECB_PvE_EnterCombat() end

	 elseif (GetRealZoneText() == NECB_AhnQirajRuins and not noreg) then
		function NECB_PvE_Yell(arg1, arg2) end
		function NECB_PvE_Emote(arg1, arg2)

			if (arg2 == "Moam") then
			
				if (string.find(arg1, NECB_PvE_Vars["MOAM_STARTING"])) then
			
					CEnemyCastBar_Control("Moam", "Until Stoneform", "pve");
				end
			end
		end
		function NECB_PvE_EnterCombat() end

	 else
		function NECB_PvE_Yell() end
		function NECB_PvE_Emote() end
		function NECB_PvE_EnterCombat() end
		NECB_no_PvE_code = true;

	 end


	 -- EXCEPTIONS:
	 --------------
	 if (GetRealZoneText() == NECB_Naxxramas and not noreg) then

		function CEnemyCastBar_Gfind_PvE(arg1, event)
			-- spell hits (Razuvious + others)
			local mob, spell, target, damage = string.match(arg1, CEnemyCastBar_SPELL_HITS);
			if (mob) then
				if (
					string.match(mob, " Razuvious")
					or mob == "Gluth"
					) then

					if (NECB_SPELL_HITS_turnit) then
						CEnemyCastBar_Control(spell, mob, "casts", nil, event);
					else
						CEnemyCastBar_Control(mob, spell, "casts", nil, event);
					end
				end
				return;
			end
		end

	 else
		CEnemyCastBar_Gfind_PvE = nil;
	 end

	 -- C'Thun death (so far the only mob checked for)
	 if (GetRealZoneText() == NECB_AhnQiraj and not noreg) then

		function NECB_PvE_death(mob)
			if (mob == NECB_PvE_Vars["CTHUN_NAME1"]) then
	
				CEnemyCastBar_DelBar("Dark Glare");
				CEnemyCastBar_DelBar("Small Eyes P1");
				CEnemyCastBar_Control("C'Thun", "First Small Eyes P2", "pve");
			end
		end
	 else
		NECB_PvE_death = nil;
	 end

	end -- code init function end
	-----------------------------

end